//
//  KDRepeat.m
//  KongDays
//
//  Created by deeplu on 13. 1. 5..
//  Copyright (c) 2013년 BlueBeans. All rights reserved.
//

#import "KDRepeat.h"

@implementation KDRepeat
@synthesize value = value_;
@synthesize displayText = displayText_;

- (void)dealloc
{
    [self.value release];
    [self.displayText release];
    
    [super dealloc];
}

- (BOOL)isEqual:(id)object
{
    if (object == nil)
        return NO;
    
    if ([object class] != [self class])
        return NO;
    
    KDRepeat *other = (KDRepeat *)object;
    
    return ([self.value isEqualToString:other.value]);
}

+ (NSArray *)all
{
    KDRepeat *none = [[KDRepeat alloc] init];
    none.value = @"none";
    none.displayText = NSLocalizedString(@"Never", nil);

    KDRepeat *month = [[KDRepeat alloc] init];
    month.value = @"month";
    month.displayText = NSLocalizedString(@"Every Month", nil);

    KDRepeat *year = [[KDRepeat alloc] init];
    year.value = @"year";
    year.displayText = NSLocalizedString(@"Every Year", nil);
    
    KDRepeat *hundred = [[KDRepeat alloc] init];
    hundred.value = @"100";
    hundred.displayText = NSLocalizedString(@"Hundred Day", nil);
    
    NSArray *result = [NSArray arrayWithObjects:none, month, year, hundred, nil];
    
    [none release];
    [month release];
    [year release];
    [hundred release];
    
    return result;
}

@end
